using System;
using System.Text;
using System.Data;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class PreferenceBLL
	{
		private PreferenceDAO _PreferenceDAO;

		public PreferenceDAO PreferenceDAO
		{
			get { return _PreferenceDAO; }
			set { _PreferenceDAO = value; }
		}

		public PreferenceBLL()
		{
			PreferenceDAO = new PreferenceDAO();
		}
		public List<Preference> GetPreferences()
		{
			try
			{
				return PreferenceDAO.GetPreferences();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}

        public Preference GetPreferences1()
        {
            try
            {
                return PreferenceDAO.GetPreferences1();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
		public Preference GetPreference(string ID)
		{
			try
			{
				return PreferenceDAO.GetPreference(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}

        public DataTable LoadStoreName()
        {
            return PreferenceDAO.LoadStoreName();
        }
		public int AddPreference(Preference oPreference)
		{
			try
			{
				return PreferenceDAO.AddPreference(oPreference);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddPreference(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string TerminalID,string CompanyName,string ShopCode,string ShopName,string Address,string Phone,string Fax,string Email,string Website,Byte[] Logo,DateTime? StartDate,DateTime? EndDate,Double? TaxRateIn,string RoundTypeIn,Double? TaxRateOut,string RoundTypeOut,Double? ExchangeRate,int? AccountId)
		{
			try
			{
				return PreferenceDAO.AddPreference(ID,CreateDate,ModifiedDate,TimeStamp,TerminalID,CompanyName,ShopCode,ShopName,Address,Phone,Fax,Email,Website,Logo,StartDate,EndDate,TaxRateIn,RoundTypeIn,TaxRateOut,RoundTypeOut,ExchangeRate,AccountId);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdatePreference(Preference oPreference)
		{
			try
			{
				return PreferenceDAO.UpdatePreference(oPreference);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdatePreference(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string TerminalID,string CompanyName,string ShopCode,string ShopName,string Address,string Phone,string Fax,string Email,string Website,Byte[] Logo,DateTime? StartDate,DateTime? EndDate,Double? TaxRateIn,string RoundTypeIn,Double? TaxRateOut,string RoundTypeOut,Double? ExchangeRate,int? AccountId)
		{
			try
			{
				return PreferenceDAO.UpdatePreference(ID,CreateDate,ModifiedDate,TimeStamp,TerminalID,CompanyName,ShopCode,ShopName,Address,Phone,Fax,Email,Website,Logo,StartDate,EndDate,TaxRateIn,RoundTypeIn,TaxRateOut,RoundTypeOut,ExchangeRate,AccountId);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemovePreference(Preference oPreference)
		{
			try
			{
				return PreferenceDAO.RemovePreference(oPreference);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemovePreference(string ID)
		{
			try
			{
				return PreferenceDAO.RemovePreference(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Preference> DeserializePreferences(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Preference>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializePreferences(string Path, List<Preference> Preferences)
		{
			try
			{
				GenericXmlSerializer<List<Preference>>.Serialize(Preferences, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
